home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech's Sprocket™ / Sprocket-01.24.95 / SprocketSample / PreferencesDialogWindow.cp < prev    next >
Encoding:
Text File  |  1994-11-12  |  1.2 KB  |  52 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        PreferencesDialogWindow.cp
  3.  
  4.     Contains:    A simple dialog window recipe
  5.                 
  6.     Written by: Dave Falkenburg
  7.     
  8.     Copyright:    © 1993-94 by Dave Falkenburg, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.      
  12.          <3>    11/12/94    DRF        Set default & cancel items as well as cursor tracking.
  13.          <2>      9/9/94    DRF        Removed redundant #include.
  14.  */
  15.  
  16. #include "PreferencesDialogWindow.h"
  17.  
  18. TPreferencesDialogWindow::TPreferencesDialogWindow() : TDialogWindow(kPreferencesDialogTemplateID)
  19.     {
  20.     //    Because TDialogWindow::TDialogWindow has already created the dialog,
  21.     //    this is a great place to grab settings & setup the contents of the
  22.     //    dialog.
  23.     //
  24.     //    Of course, if you do this you probably want to mark the DLOG
  25.     //    as not initially visible, then call ShowWindow just before returning.
  26.     //
  27.     //    You should also setup UPPs for any user items in here, too. 
  28.  
  29.     //    Set up the default buttons
  30.     //    Isn’t it neat that these also work for modeless dialogs?
  31.     
  32.     SetDialogDefaultItem(fWindow,ok);
  33.     SetDialogCancelItem(fWindow,cancel);
  34.     SetDialogTracksCursor(fWindow,true);
  35.     }
  36.  
  37. void
  38. TPreferencesDialogWindow::ItemHit(short theItem)
  39.     {
  40.     switch (theItem)
  41.         {
  42.         case    ok:
  43.         case    cancel:
  44.             this->Close();
  45.             delete this;
  46.             break;
  47.             
  48.         default:
  49.             break;
  50.         }
  51.     }
  52.